<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品档案登记复核</title>
    <link rel="stylesheet" href="../../css/pintuer.css">
    <link rel="stylesheet" href="../../css/admin.css">
    <link rel="stylesheet" href="../../css/bootstrap.css">
    <style>
        input{
            border-top: none;
            border-left: none;
            border-right: none;
            border-bottom: black solid 1px;
        }
        table{
            border: 1px;
            cell-padding:0;
            cell-spacing:0;
            width: 80%;
            margin-top: 20px;
        }
        table thead{
            background-color:#b3d7ff ;
        }
        a{
            cursor: pointer;
        }
    </style>
</head>
<body bgcolor="#dcdcdc">
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/bootstrap-table1.15.3.js"></script>
<script>
    function initTable(){
        $.ajax({
            url:'/dFile/selectByConState.action',
            type:'post',
            dataType:'json',
            data:'state=S001-0',
            success:function (data) {
                var tb = $('#tb_com');
                tb.empty();
                for( var i=0;i<data.length;i++){
                    var tr=$("<tr>");

                    var PID = $("<td>").text(data[i].PRODUCT_ID);
                    tr.append(PID);

                    var pname =$("<td>").text(data[i].PRODUCT_NAME);
                    tr.append(pname);

                    var type = $('<td>').text(data[i].TYPE==="Y001-1"?"商品":"物料");
                    tr.append(type);

                    var itype = $('<td>').text(data[i].FIRST_KIND_NAME);
                    tr.append(itype);

                    var iitype = $("<td>").text(data[i].SECOND_KIND_NAME);
                    tr.append(iitype);

                    var iiitype = $("<td>").text(data[i].THIRD_KIND_NAME);
                    tr.append(iiitype);

                    var resperson = $("<td>").text(data[i].RESPONSIBL_PERSON);
                    tr.append(resperson);

                    var t = $("<td>");
                    var a = $("<a style='color: #33bbdd;'>").text("复核");
                    // a.attr("name",data[i].ID);
                    a.attr("onclick","btn("+data[i].ID+");");
                    t.append(a);
                    tr.append(t);

                    tb.append(tr);

                }
            }
        })
    }
       $(function () {
        initTable();

        $('.close , .close_btn').click(function () {
            $('#composite').hide();
        });

        $('#adopt').click(function () {
                var frm = $('#frm').serialize();
                frm = decodeURIComponent(frm,true);
                // var f_name = $('select[name="FIRST_KIND_ID"]').find("option:selected").text();
                // var s_name = $('select[name="SECOND_KIND_ID"]').find("option:selected").text();
                // var t_name = $('select[name="THIRD_KIND_ID"]').find("option:selected").text();
                $.ajax({
                    url:'/dFile/adoptComposite.action',
                    type:'get',
                    data:frm,
                    success:function (data) {
                        $('#composite').modal("hide");
                        initTable();
                    }
                })
        });
    })
    function btn(id) {
        $.ajax({
           url:'/dFile/checkById',
           data: 'id='+id,
           dataType: 'json',
           type: 'get',
           success:function (data) {
               $('#composite').modal("show");
               $("input[name='PRODUCT_NAME']").val(data.PRODUCT_NAME);
               $("input[name='FACTORY_NAME']").val(data.FACTORY_NAME);
               $('input[name="PRODUCT_NICK"]').val(data.PRODUCT_NICK);
               $('input[name="FIRST_KIND_NAME"]').val(data.FIRST_KIND_NAME);
               $('input[name="SECOND_KIND_NAME"]').val(data.SECOND_KIND_NAME);
               $('input[name="THIRD_KIND_NAME"]').val(data.THIRD_KIND_NAME);
               $('input[name="PERSONAL_UNIT"]').val(data.PERSONAL_UNIT);
               $('input[name="PERSONAL_VALUE"]').val(data.PERSONAL_VALUE);
               $('input[name="LIST_PRICE"]').val(data.LIST_PRICE);
               $('input[name="COST_PRICE"]').val(data.COST_PRICE);
               $('input[name="WARRANTY"]').val(data.WARRANTY);
               $('input[name="TWIN_NAME"]').val(data.TWIN_NAME);
               $('input[name="TWIN_ID"]').val(data.TWIN_ID);
               $('input[name="LIFECYCLE"]').val(data.LIFECYCLE);
               $('input[name="AMOUNT_UNIT"]').val(data.AMOUNT_UNIT);
               $('textarea[name="PROVIDER_GROUP"]').val(data.PROVIDER_GROUP);
               $('textarea[name="PRODUCT_DESCRIBE"]').val(data.PRODUCT_DESCRIBE);
               $('input[name="REGISTER"]').val(data.REGISTER);
               $('input[name="REGISTER_TIME"]').val(data.REGISTER_TIME);
               $('select[name="TYPE"]').val(data.TYPE);
               $('select[name="PRODUCT_CLASS"]').val(data.PRODUCT_CLASS);
               $('input[name="CHECK_TAG"]').val(data.CHECK_TAG);
               $('input[name="DELETE_TAG"]').val(data.DELETE_TAG);
               $("input[name='DESIGN_MODULE_TAG']").val(data.DESIGN_MODULE_TAG);
               $('input[name="DESIGN_PROCEDURE_TAG"]').val(data.DESIGN_PROCEDURE_TAG);
               $('input[name="DESIGN_CELL_TAG"]').val(data.DESIGN_CELL_TAG);
               $('input[name="PRODUCT_ID"]').val(data.PRODUCT_ID);
               $('input[name="ID"]').val(data.ID);
               $('input[name="RESPONSIBL_PERSON"]').val(data.RESPONSIBL_PERSON);

               var username = localStorage.getItem("userName");
               $("input[name='CHECKER']").val(username);


               var myDate = new Date;
               var year = myDate.getFullYear(); //获取当前年
               var mon = myDate.getMonth() + 1; //获取当前月
               var date = myDate.getDate(); //获取当前日
               var h = myDate.getHours();//获取当前小时数(0-23)
               var m = myDate.getMinutes();//获取当前分钟数(0-59)
               var s = myDate.getSeconds();//获取当前秒
               $('input[name="CHECK_TIME"]').val(year+"-"+mon+'-'+date+' '+h+':'+m+':'+s);

           }
        });
    }
</script>
<div class="container-fluid">

    <div style="width: 100%;margin: 0px;padding: 0px">

        <table class="table table-bordered table-hover table-striped table-condensed">
            <thead>
            <tr>
                <th>产品编号</th>
                <th>产品名称</th>
                <th>用途类型</th>
                <th>I级分类</th>
                <th>II级分类</th>
                <th>III级分类</th>
                <th>产品经理</th>
                <th>复核</th>
            </tr>
            </thead>
            <tbody id="tb_com">
            </tbody>
        </table>
    </div>

</div>
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" id="composite">
    <div class="modal-dialog" style="width: 80%;background-color: #d1ecf1;">

        <div class="modal-content" style="border: 1px solid black;">

            <div class="modal-header" style="height: 20%;">
                <h5>产品档案复核</h5>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-right: 0px"></button>
            </div>

            <div class="modal-body">
            <form id="frm">
                <input type="hidden" name="ID">
                <input type="hidden" name="CHECK_TAG">
                <input type="hidden" name="DELETE_TAG">
                <input type="hidden" name="DESIGN_MODULE_TAG">
                <input type="hidden" name="DESIGN_PROCEDURE_TAG">
                <input type="hidden" name="DESIGN_CELL_TAG">

                <table width="80%" style="border-collapse:separate; border-spacing:0px 10px;">
                    <tr>
                        <td>产品编号：</td>
                        <td colspan="3"><input type="text" style="background-color: white;" readonly name="PRODUCT_ID"></td>
                    </tr>
                    <tr>
                        <td colspan="4"><div style="margin: 0px;padding: 0px; background-color: #09c"><span style="color: #eeffff">主信息</span></div></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">产品名称：</span></td>
                        <td><input type="text" name="PRODUCT_NAME"></td>
                        <td><span style="color: black;">制造商：</span></td>
                        <td><input type="text" name="FACTORY_NAME"></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">I级分类：</span></td>
                        <td><input readonly="readonly" name="FIRST_KIND_NAME"></td>
                        <td><span style="color: black;">II级分类：</span></td>
                        <td><input readonly="readonly" name="SECOND_KIND_NAME"></td>
                    </tr>

                    <tr>
                        <td><span style="color: black;">III级分类：</span></td>
                        <td><input readonly="readonly" name="THIRD_KIND_NAME"/></td>
                        <td><span style="color: black;">产品简称：</span></td>
                        <td><input type="text" name="PRODUCT_NICK"/></td>
                    </tr>

                    <tr>
                        <td><span style="color: black;">用途类型：</span></td>
                        <td><select name="TYPE">
                            <option value="Y001-1">商品</option>
                            <option value="Y001-2">物料</option>
                        </select></td>
                        <td><span style="color: black;">档次级别：</span></td>
                        <td><select name="PRODUCT_CLASS">
                            <option value="D001-1">高档</option>
                            <option value="D001-2">中档</option>
                            <option value="D001-3">低档</option>
                        </select></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">计量单位：</span></td>
                        <td><input type="text" name="PERSONAL_UNIT"></td>
                        <td><span style="color: black;">计量值：</span></td>
                        <td><input type="text" name="PERSONAL_VALUE"></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">市场单价（元）：</span></td>
                        <td><input type="text" name="LIST_PRICE"></td>
                        <td><span style="color: black;">计划成本单价（元）：</span></td>
                        <td><input type="text" name="COST_PRICE"></td>
                    </tr>
                    <!--<tr>
                        <td colspan="4"><div style="margin: 0px;padding: 0px; background-color: #09c"><span style="color: #eeffff">辅助信息</span></div></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">保修期：</span></td>
                        <td><input type="text" name="WARRANTY"></td>
                        <td><span style="color: black;">替代品名称：</span></td>
                        <td><input type="text" name="TWIN_NAME"></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">替代品编号：</span></td>
                        <td><input type="text" name="TWIN_ID"></td>
                        <td><span style="color: black;">生命周期（年）：</span></td>
                        <td><input type="text" name="LIFECYCLE"></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">单位：</span></td>
                        <td><input type="text" name="AMOUNT_UNIT"></td>
                        <td><span style="color: black;">产品经理：</span></td>
                        <td><input readonly="readonly" name="RESPONSIBL_PERSON"></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">供应商集合：</span></td>
                        <td><textarea  name="PROVIDER_GROUP"></textarea></td>
                        <td><span style="color: black;">产品描述：</span></td>
                        <td><textarea  name="PRODUCT_DESCRIBE"></textarea></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">登记人：</span></td>
                        <td><input type="text"  name="REGISTER"/></td>
                        <td><span style="color: black;">复核时间：</span></td>
                        <td><input type="text" name="CHECK_TIME"/></td>
                    </tr>
                    <tr>
                        <td><span style="color: black;">复核人：</span></td>
                        <td colspan="2"><input type="text"  name="CHECKER"/></td>

                    </tr>-->
                </table>
            </form>
                <div class="modal-footer">
                    <button type="button" id="adopt" class="btn btn-primary">复核通过</button>
                    <button type="button" class="btn btn-primary close_btn" data-dismiss="modal">取消</button>
                </div>
            </div>

        </div>
    </div>
</div>
</body>
</html>